<?php

namespace app\common\model;

use think\model\concern\SoftDelete;

class RobotFiles extends \think\Model
{
    use SoftDelete;

    protected $table = 'db_robot_files';

    protected $jsonAssoc = true;

    protected $autoWriteTimestamp = true;

    protected $schema = [
        'id' => 'int',
        'create_time' => 'int',
        'update_time' => 'int',
        'delete_time' => 'int',
        'pubid' => 'varchar',
        'name' => 'varchar',
        'robot_id' => 'int',
        'number_of_documents' => 'int',
        'is_url' => 'tinyint',
        'is_train' => 'tinyint',
        'original_name' => 'text',
        'save_location' => 'text',
        'sha1' => 'varchar',
        'is_merge' => 'tinyint',
        'is_confirm' => 'tinyint',
        'word_count' => 'int',
    ];

    public $getters = [
        
    ];

    /**
     * 关联模型openaiUsage
     */
    public function openaiUsage()
    {
        return $this->hasMany(OpenaiUsage::class );
    }

    /**
     * 关联模型robot
     */
    public function robot()
    {
        return $this->belongsTo(Robot::class );
    }
}
